import pandas as pd
data=pd.read_excel('Data.xlsx')
data=data[data>0]
data=data.dropna()
from sklearn.preprocessing import StandardScaler
X=data.iloc[:,1:]
scaler=StandardScaler()
scaler.fit(X)
X=scaler.transform(X)
from sklearn.decomposition import PCA
pca=PCA(n_components=0.95)
Y=pca.fit_transform(X)
gxl=pca.explained_variance_ratio_
import numpy as np
F=np.zeros((len(Y)))
for i in range(len(gxl)):
    f=Y[:,i]*gxl[i]
    F=F+f
fsl=pd.Series(F,index=data['ts_code'].values)
Fscorel=fsl.sort_values(ascending=False)
print(Fscorel)